<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="Rover.Rover" %>
<%@ page import="Page.Page"   %>
<%@ page import="java.util.*"  %>
<%@ page import="Rover.RoverDeal"%>
<script type="text/javascript" language="javaScript">

	function modify(url){
	window.location.href = ("RoverModify.jsp?DealID="+url);
	//document.form1.action("AdminModify.jsp?DealID="+url);
	}

</script>
<%
   //从数据库中去出结果集
   int currentRecord = 0;
   String DealID="";
   String sql="";
   Page pager=new Page();
   RoverDeal db=new RoverDeal();
   ArrayList<Rover> result =db.RoverShow(); 
   pager.setPageSize(6);
   pager.setTotalRecord(result.size());
   pager.setTotalPage(result.size(),pager.getPageSize());
   //计算并设置分页的参数
   if(request.getParameter("currentRecord")!=null)
   {   
       currentRecord = Integer.parseInt(request.getParameter("currentRecord"));
       pager.setCurrentRecord(currentRecord);
       pager.setCurrentPage(currentRecord,pager.getPageSize());
   }
   //从结果集中取出当前页面要显示的子集
   List<Rover> subResult = null;
   if(currentRecord == 0)
   {
       if(currentRecord+pager.getPageSize()<=result.size())
       {
            subResult = result.subList(0,pager.getPageSize());
       	
       }
       else
       {
       	   	subResult = result.subList(0,result.size());
       }
   
   }
   else if(pager.getCurrentRecord()+pager.getPageSize()<result.size())
       subResult = result.subList(pager.getCurrentRecord(),pager.getCurrentRecord

()+pager.getPageSize());
   else
       subResult = result.subList(pager.getCurrentRecord(),result.size());
 %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>查看流动站</title>
<link href="../css/RoverCommodity.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<div class="RoverCommodity_top"><span class="RoverCommodity_top_font">当前位置:东师流动站———>流动站信息</span></div>
    <div class="RoverCommodity_detail"><span class="RoverCommodity_detail_font">流动站信息</span>
    <div  class="RoverCommodity_detail_classify">
    <table width="900" height="53"border="0">
  <tr>
    <td width="203" height="47"><img src="../images/hoverLook_12.png" width="70" height="14" /></td>
    <td width="155"><img src="../images/hoverLook_03.png" width="70" height="15" /></td>
    <td width="157"><img src="../images/hoverLook_05.png" width="71" height="15" /></td>
    <td width="178"><img src="../images/hoverLook_07.png" width="57" height="17" /></td>
    <td width="185"><img src="../images/hoverLook_09.png" width="42" height="15" /></td>
  </tr>

     		<%
   			 if(subResult.isEmpty()==false)
		       {
		             for(int i=0;i<subResult.size();i++)
		             {
		            	 Rover Rover = subResult.get(i);
		            	 RoverDeal d=new RoverDeal();%>
		            	     <tr>
    <td width="203" height="47"><%=Rover.getRovID() %></td>
    <td width="155"><%=Rover.getAdmID() %></td>
    <td width="157"><%=Rover.getRovName() %></td>
    <td width="178"><%=Rover.getComMax() %></td>
    <td width="185"><input type= "button" value="编辑"   onclick="modify('<%=Rover.getRovID()%>')"></input></td>
  </tr>
  <%} %>
  <%} %>
</table>
</div>
        <div class="RoverCommodity_detail_page_page">
   	<span><font size="2">总<%=pager.getTotalRecord()%>条记录|总<%=pager.getTotalPage()%>页|当

前<%=pager.getCurrentPage()+1%>页|每页<%=pager.getPageSize()%>条|
<% 
    //如果已经到了首页就去掉前一页的链接
    if(pager.getCurrentRecord()-pager.getPageSize()<0)
        out.println("首页|");
    else
    //上一页就是把当前记录位置减去一页显示记录的条数
        out.print("<a href='RoverShow.jsp?currentRecord="+(pager.getCurrentRecord()-

pager.getPageSize())+"&pageSize="+pager.getPageSize()+"'>上一页</a>|");
    //如果到了尾页就去掉下一页的链接
    if(pager.getCurrentRecord()+pager.getPageSize()>=pager.getTotalRecord())
        out.println("尾页");
    else
    //下一页就是把当前记录位置加上一页显示记录的条数
        out.print("<a href='RoverShow.jsp?currentRecord="+(pager.getCurrentRecord

()+pager.getPageSize())+"&pageSize="+pager.getPageSize()+"'>下一页</a>|"); 
%>
</font></span> </div>
    </div> 
</body>
</html>
